package ex_6_syncBlockLockAll;

public class Service {
    public void testMethod(MyObject object){
        synchronized (object){
            try {
                System.out.println("testMethod getLock time=" + System.currentTimeMillis() + " run ThreadName =" +
                        Thread.currentThread().getName());
                Thread.sleep(2000);
                System.out.println("testMethod releaseLock time=" + System.currentTimeMillis() + " run ThreadName =" +
                        Thread.currentThread().getName());
            }catch (Exception e){
                e.printStackTrace();
            }
        }

    }
}
